package StructuralPatterns.Flyweight;

public class Test {

  static final String [] colors = new String[]{"Red", "Green", "Blue", "White", "Black"};

  public static void main(String[] args) {
    for (int i = 0; i < 10; i++) {
      Circle circle = (Circle) ShapeFactory.getCircleMap(getColor());
      circle.setX(getRandomX());
      circle.setY(getRandomY());
      circle.setRadius(100);
      circle.draw();
    }
  }

  public static String getColor(){
    return colors[(int)(Math.random()*colors.length)];
  }

  public static int getRandomX() {
    return (int)(Math.random()*100 );
  }
  public static int getRandomY() {
    return (int)(Math.random()*100);
  }
}
